package controllers

import (
	"github.com/astaxie/beego"
	"github.com/beego/beego/v2/core/logs"
)

type baseController struct {
	beego.Controller
}

func (c baseController) resp(data interface{}) {
	res := make(map[string]interface{})
	res["code"] = 200
	res["msg"] = "success"
	res["data"] = data
	c.Data["json"] = &res
	c.ServeJSON()
	logs.Info("success")
}
func (c baseController) respErr(msg string) {
	res := make(map[string]interface{})
	res["code"] = 500
	res["msg"] = msg
	c.Data["json"] = &res
	c.ServeJSON()
	logs.Error("error")
}
